package com.hualan.sfzy.controller;

import com.hualan.sfzy.entity.ChargingClassification;
import com.hualan.sfzy.service.ChargingClassificationService;
import com.hualan.sfzy.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController()
@RequestMapping("/chargingClassification")
public class ChargingClassificationController {
    @Autowired
    private ChargingClassificationService chargingClassificationService;

    @GetMapping("/find")
    public Result findById(@RequestParam int id) {
        ChargingClassification chargingClassification = chargingClassificationService.findById(id);
        if (chargingClassification != null) {
            return Result.success(chargingClassification);
        }
        return Result.error("查找失败");
    }
}
